package com.blobfish.fiction.common.hutool.converter;

import cn.hutool.core.convert.Converter;
import cn.hutool.core.convert.ConverterRegistry;
import com.blobfish.fiction.book.dto.BookDto;
import com.blobfish.fiction.common.base.model.BaseEntityDto;
import com.blobfish.fiction.common.model.Book;

public class Dto2JBeanConverter implements Converter<BaseEntityDto> {
    @Override
    public BaseEntityDto convert(Object o, BaseEntityDto baseEntityDto) throws IllegalArgumentException {

        return null;
    }

    public static void main(String[] args) {
        // 测试自定义实体转换器
        ConverterRegistry converterRegistry = ConverterRegistry.getInstance();
        converterRegistry.putCustom(Book.class, Dto2JBeanConverter.class);
        BookDto dto = new BookDto();
        dto.setName("测试小说名称");
        Book book = converterRegistry.convert(Book.class, dto);
    }
}
